using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace EVEChat
{
    public partial class Settings : Form
    {
        public Settings()
        {
            InitializeComponent();
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.logPath = logDir.Text;

            Properties.Settings.Default.Save();
            this.Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void logdirBrowseButton_Click(object sender, EventArgs e)
        {
            folderBrowserDialog.ShowDialog();
            logDir.Text = folderBrowserDialog.SelectedPath + "\\";
        }

        private void Settings_Load(object sender, EventArgs e)
        {
            // When settings page loads... fill in all the saved values
            logDir.Text = Properties.Settings.Default.logPath;
        }

        private void logDir_TextChanged(object sender, EventArgs e)
        {
            // Okay, they've picked a directory.. lets see if the chat & game logs exist
            if (Directory.Exists(logDir.Text + "Chatlogs"))
            {
                chatlogLabelChange.Text = "Found";
                chatlogLabelChange.ForeColor = Color.Green;
            }
            else
            {
                chatlogLabelChange.Text = "Not Found";
                chatlogLabelChange.ForeColor = Color.Firebrick;
            }

            if (Directory.Exists(logDir.Text + "Gamelogs"))
            {
                gamelogLabelChange.Text = "Found";
                gamelogLabelChange.ForeColor = Color.Green;
            }
            else
            {
                gamelogLabelChange.Text = "Not Found";
                gamelogLabelChange.ForeColor = Color.Firebrick;
            }
        }
    }
}